//
//  ViewController.m
//  CustomizeCell
//
//  Created by xiewei on 16/6/18.
//  Copyright © 2016年 xiewei. All rights reserved.
//

#import "ViewController.h"
#import "XWCell.h"

#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
/// tabView
@property (nonatomic,strong) UITableView *tabview;
/// 数据源
@property (nonatomic,strong) NSMutableArray *mArr;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tabview.dataSource = self;
    self.tabview.delegate = self;
    
    /// 设置cell的高度
    self.tabview.rowHeight = 100;
}

#pragma mark - UITableViewDelegate,UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.mArr count];
}

- (XWCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    XWCell *cell = [XWCell xwCellWithTableView:tableView];
    cell.urlStr = self.mArr[indexPath.row];
    
    return cell;
}
#pragma mark - 懒加载
- (UITableView *)tabview {
    if (_tabview == nil) {
        _tabview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        [self.view addSubview:_tabview];
    }
    return _tabview;
}
- (NSMutableArray *)mArr {
    if (_mArr == nil) {
        _mArr = [[NSMutableArray alloc] init];
        
        for (int i = 0; i < 10; i++) {
            [_mArr addObject:@"22.jpg"];
        }
    }
    return _mArr;
}

@end
